-
Notifications
You must be signed in to change notification settings - Fork 0
[CORRUPTED] Synthetic Benchmark PR #137712 - Add User Profile Size Limit Enforced During Profile Updates #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: base_pr_137712_20251204_2220
Are you sure you want to change the base?
Conversation
…ential heap memory exhaustion.
…ecurity/profile/ProfileService.java Co-authored-by: Johannes Fredén <[email protected]>
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
User description
Benchmark PR elastic#137712
Type: Corrupted (contains bugs)
Original PR Title: Add User Profile Size Limit Enforced During Profile Updates
Original PR Description: Currently, there are no limits on the size of a user profile. Profiles store username, initials, avatars, etc.
Authorized Kibana observability clients can store an unlimited amount of data in user profile via update-profile.
This change puts a limit on profile size to avoid heap memory pressure and OOM crashes.
A new configuration setting,
xpack.security.profile.max_size, was introduced with a default value of 10 MB to remain safely above the 1 MB request limit size enforced by Kibana.Limit enforcement is implemented with a profile document read before the update, to provide a full view of the profile footprint. This approach is intended to be lightweight. Still, a document read is now incurred for every update request.
Original PR URL: elastic#137712
PR Type
Enhancement, Tests
Description
Add configurable user profile size limit to prevent heap exhaustion
xpack.security.profile.max_sizewith 10 MB defaultImplement profile size validation during update operations
ElasticsearchStatusExceptionwhen size exceeds limitAdd comprehensive unit and integration tests for quota enforcement
Diagram Walkthrough
flowchart LR A["Profile Update Request"] --> B["Read Current Profile"] B --> C["Calculate Combined Size"] C --> D{"Size < Limit?"} D -->|Yes| E["Apply Update"] D -->|No| F["Reject with Error"] E --> G["Return Success"] F --> H["Return BAD_REQUEST"]File Walkthrough
ProfileService.java
Implement profile size limit validation logicx-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/profile/ProfileService.java
MAX_SIZE_SETTINGconfiguration for profile size limit (10 MBdefault)
maxProfileSizeas instance variable initialized from settingsvalidateProfileSize()static method to check profilefootprint
combineMaps(),mapFromBytesReference(),serializationSize()updateProfileData()to validate size after update via documentread
Security.java
Register profile size limit settingx-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java
ProfileService.MAX_SIZE_SETTINGin security plugin settingslist
ProfileIntegTests.java
Add integration test for quota enforcementx-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/profile/ProfileIntegTests.java
testUpdateProfileDataHitStorageQuota()integration testElasticsearchExceptionis thrown on overflowProfileServiceTests.java
Add unit tests for size validation helpersx-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/profile/ProfileServiceTests.java
testSerializationSize()to verify size calculationtestMapFromBytesReference()for bytes conversiontestCombineMaps()for map merging logictestValidateProfileSize()for validation behaviornewBytesReference()for test utilities137712.yaml
Add changelog entry for profile size limitdocs/changelog/137712.yaml